import React, { PureComponent } from 'react';
import Chart from '../../../utils/chart';
import { mapOptions } from './options';

class Map extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      renderer: 'canvas',
    };
  }
  getAllData=(e)=>{
    // console.log(e);
    if(!e.marker){ return }
    this.props.getAllData(e);
  }
  render() {
    const { renderer } = this.state;
    const { mapData } = this.props;
    return (
      <div
        style={{
          width: '10.625rem',
          height: '8.125rem',
        }}>
          {
            mapData?<Chart renderer={renderer} option={mapOptions(mapData)}  getAllData={this.getAllData}/>:''
          }
      </div>
    );
  }
}


export default Map;
